﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="设备管理.aspx.cs" Inherits="syc.Jidong.设备管理" %>
<html>
<head>
<title></title>
<style>
div.autofinish{position:absolute; z-index:2;border:solid 1px #ccaa88;background-color:#ffffff;padding:5px;font-size:14px;color:#ff0000;}
#BianHao{background-image:url(/images/bmback.gif); background-repeat:no-repeat;}
</style>
</head>
<body>
<script type="text/javascript" language="javascript" src="/common.js"></script>
<form id="form1" runat="server">
<asp:Label ID="SelectedID" runat="server" Text="" Visible="false"></asp:Label>
<asp:Label ID="SqlText" runat="server" Text="" Visible="false"></asp:Label>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<%$ ConnectionStrings:SCMConnectionString1 %>"
onselected="SqlDataSource1_Selected" ></asp:SqlDataSource>

<div id="wintop" class="wintop">设备资产管理</div>

<asp:Panel ID="Panel1" runat="server" CssClass="panel">
    <input type="button" value="录 入" class="button" onclick="parent.swin2_load('/JiDong/设备登记.aspx',820,296);"/>
    <asp:Button ID="Button_Edit" runat="server" Text="查看/修改" CssClass="button" UseSubmitBehavior="False"/>   
    <asp:Button ID="Button_Annex" runat="server" Text="附 件" UseSubmitBehavior="false" CssClass="button" />  
    <asp:Button ID="Button_Tran" runat="server" Text="转 移" UseSubmitBehavior="false" CssClass="button" />
    <asp:Button ID="Button_Discard" runat="server" Text="报 废" UseSubmitBehavior="false" CssClass="button" />
    <asp:Button ID="Button_Delete" runat="server" Text="删 除" CssClass="button"  
        UseSubmitBehavior="False" 
        OnClientClick="if(!confirm('确认要删除该条记录吗？'))return(false);" 
        onclick="Button_Delete_Click" />
</asp:Panel>

<asp:Panel ID="Panel2" runat="server" CssClass="panel" GroupingText="设备资产查询">
编号：<asp:TextBox ID="BianHao" runat="server" Width="120" CssClass="textbox"></asp:TextBox>
<span style="margin-left:6px;"></span>名称：<asp:TextBox ID="MingCheng" runat="server" Width="120" CssClass="textbox"></asp:TextBox>
<span style="margin-left:6px;"></span>投产日期：<asp:TextBox ID="Date1" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date1').value, document.getElementById('Date1'));" />
至
<asp:TextBox ID="Date2" runat="server" CssClass="textbox" Width="105px"></asp:TextBox><img alt="" src="/Icons/29.png" align="middle" onclick="makecalendar(document.getElementById('Date2').value, document.getElementById('Date2'));" />
<span style="margin-left:6px;"></span><asp:Button ID="Button_Reset" runat="server" Text="清空条件" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Reset_Click" />
<br />
型号：<asp:TextBox ID="XingHao" runat="server" Width="120" CssClass="textbox"></asp:TextBox>
<span style="margin-left:6px;"></span>厂家：<asp:TextBox ID="ChangJia" runat="server" Width="120" CssClass="textbox"></asp:TextBox>
<span style="margin-left:6px;"></span><asp:CheckBox ID="BaoFei" runat="server" Text="显示报废设备" />
<span style="margin-left:28px;"></span>
<asp:Button ID="Button_Query" runat="server" Text="查 询" UseSubmitBehavior="false" 
        CssClass="mbutton" onclick="Button_Query_Click" />
        
<asp:Button ID="Button_TaiZhang" runat="server" Text="设 备 台 账..." UseSubmitBehavior="false" 
        CssClass="mbutton2" onclick="Button_TaiZhang_Click"/>
        
<asp:Button ID="Button_MingXi" runat="server" Text="固定资产明细..." UseSubmitBehavior="false" 
        CssClass="mbutton2" onclick="Button_MingXi_Click" />

</asp:Panel>

<asp:Panel ID="Panel_Msg" runat="server" CssClass="panel2">
    <asp:Label ID="Message" runat="server" Text="·准备就绪" CssClass="prompt"></asp:Label>
</asp:Panel>

<div class="gridframe">
    <div class="gridview">
    
        <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#e5cfab">
            <tr>
	            <td class="grid-title">设备资产登记记录</td>
	        </tr>
	        <tr>
	            <td class="grid-back">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                        AutoGenerateColumns="False" CssClass="grid" DataKeyNames="ID,状态" 
                        DataSourceID="SqlDataSource1"
                        PageSize="15"
                        GridLines="None" ondatabound="GridView1_DataBound" 
                        onpageindexchanged="GridView1_PageIndexChanged" AllowSorting="True" 
                        UseAccessibleHeader="False" 
                        onselectedindexchanged="GridView1_SelectedIndexChanged">
                        <PagerSettings Visible="False" />
                        <RowStyle CssClass="grid-row-normal" />
                        <Columns>
                        
                            <asp:TemplateField HeaderText="">
                                <ItemTemplate>
                                    <asp:Button ID="Button_xz" runat="server" CommandName="Select" Text="选择" CssClass="hide"/>
                                    <img src="/Icons/online.gif" style="margin-top:2px;" alt="" />
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Center" Width="20px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="编 号" SortExpression="编码">
                                <ItemTemplate>
                                    <asp:Label ID="Label_bh" runat="server" Text='<%# Eval("编码") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="100px" />
                            </asp:TemplateField>

                            <asp:TemplateField HeaderText="名 称" SortExpression="名称">
                                <ItemTemplate>
                                    <asp:Label ID="Label_mc" runat="server" Text='<%# Eval("名称") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="80px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="型 号">
                                <ItemTemplate>
                                    <asp:Label ID="Label_ch" runat="server" Text='<%# Eval("型号") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="80px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="生成厂家" SortExpression="厂家">
                                <ItemTemplate>
                                    <asp:Label ID="Label_cj" runat="server" Text='<%# Eval("厂家") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="Left" Width="80px" />
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="总成本(元)" SortExpression="总成本">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zcb" runat="server" Text='<%# Eval("总成本") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="right" Width="70px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="出厂日期" SortExpression="出厂日期">
                                <ItemTemplate>
                                    <asp:Label ID="Label_cc" runat="server" Text='<%# Eval("出厂日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="70px" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="投产日期" SortExpression="投产日期">
                                <ItemTemplate>
                                    <asp:Label ID="Label_tc" runat="server" Text='<%# Eval("投产日期","{0:d}") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="80px" />
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="附件数" SortExpression="附件数">
                                <ItemTemplate>
                                    <asp:Label ID="Label_fj" runat="server" Text='<%# Eval("附件数") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="40px" />
                            </asp:TemplateField>
                            
                             <asp:TemplateField HeaderText="状态" SortExpression="状态">
                                <ItemTemplate>
                                    <asp:Label ID="Label_zt" runat="server" Text='<%# Eval("状态描述") %>'></asp:Label>
                                </ItemTemplate>
                                <HeaderStyle CssClass="grid-header" />
                                <ItemStyle CssClass="grid" HorizontalAlign="center" Width="40px" />
                            </asp:TemplateField>
                            
                        </Columns>
                        <SelectedRowStyle CssClass="grid-row-selected" />
                      </asp:GridView>
	            </td>
            </tr>
            <tr>
	            <td>   
	                <table width="100%">
	                    <tr>
	                        <td class="pagebar">
                                <asp:Button ID="Button_Pager_First" UseSubmitBehavior="false" runat="server" Text="" ToolTip="首页" 
                                    CssClass="pageturn-first-b" onclick="Pager_Click" CommandName="--" />
                                <asp:Button ID="Button_Pager_Prev" UseSubmitBehavior="false" runat="server" Text="" ToolTip="上一页" 
                                    CssClass="pageturn-prev-b" onclick="Pager_Click" CommandName="-" />
                                <input type="button" class="page-split" UseSubmitBehavior="false" disabled />第<asp:TextBox 
                                    ID="TextBox_Pager" AutoPostBack="True" runat="server" CssClass="pageturn" 
                                    ontextchanged="Pager_Click"></asp:TextBox>页<input type="button" class="page-split" disabled /><asp:Label ID="Label_Pages" UseSubmitBehavior="false" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                                
                                <asp:Button ID="Button_Pager_Next" UseSubmitBehavior="false" runat="server" Text="" ToolTip="下一页" 
                                    CssClass="pageturn-next-b" onclick="Pager_Click" CommandName="+" />
                                <asp:Button ID="Button_Pager_Last" UseSubmitBehavior="false" runat="server" Text="" ToolTip="末页" 
                                    CssClass="pageturn-last-b" onclick="Pager_Click" CommandName="++" /><asp:Label ID="Label9" runat="server"></asp:Label><input type="button" class="page-split" disabled />
                            </td>
                            <td class="pagebar" align="right">
                                <asp:Label ID="Label_Total" runat="server"></asp:Label>
                            </td>
                        </tr>
                   </table>

	            </td>
            </tr>
        </table>
        

    </div>
</div>

</form>
<script>

    var textboxs = document.getElementsByTagName("input");
    var i;
    for (i = 0; i < textboxs.length; i++) {
        if (textboxs[i].className == "textbox") {
            //textboxs[i].onchange = function(e) { this.className = "textbox-changed"; };
            textboxs[i].onfocus = function(e) { this.select(); };
        }
        else if (textboxs[i].className == "pageturn" || textboxs[i].className == "intxt1" || textboxs[i].className == "intxt2") {
            textboxs[i].onfocus = function(e) { this.select(); };
        }
    }
    var rows = document.getElementsByTagName("tr");
    for (i = 0; i < rows.length; i++) {

        if (rows[i].className == "grid-row-normal") {
            rows[i].onmouseover = function() { this.className = "grid-row-bright"; };
            rows[i].onmouseout = function() { this.className = "grid-row-normal"; };
            rows[i].onclick = selectRow;
        }
        else if (rows[i].className == "grid-row-selected") {
        rows[i].onclick = function() { parent.swin2_load('/JiDong/设备登记.aspx?id=<%=this.SelectedID.Text %>', 820, 296); }; 
        }
    }

    var id = "<%=this.SelectedID.Text %>";

    var Button_Edit = document.getElementById("Button_Edit");
    if (Button_Edit) {
        Button_Edit.onclick = function() {
        parent.swin2_load("/JiDong/设备登记.aspx?id=" + id, 820, 296)
        };
    }

    var Button_Annex = document.getElementById("Button_Annex");
    if (Button_Annex) {
        Button_Annex.onclick = function() {
            parent.swin2_load("/JiDong/设备附件.aspx?id=" + id, 780, 600,"yes");
        };
    }

    var Button_Tran = document.getElementById("Button_Tran");
    if (Button_Tran) {
        Button_Tran.onclick = function() {
        parent.swin2_load("/JiDong/设备内部转移.aspx?id=" + id, 770, 232)
        };
    }

    var Button_Discard = document.getElementById("Button_Discard");
    if (Button_Discard) {
        Button_Discard.onclick = function() {
            parent.swin2_load("/JiDong/设备报废申请.aspx?id=" + id, 800, 360);
        };
    }

    document.onkeydown = function(e) {
        if (!e) e = window.event;
        var tag = e.srcElement;
        if (!tag) tag = e.target;
        if (tag.tagName != "INPUT" || tag.className != "textbox") return;
        if (tag.id == "BeiZhu") return;
        if (tag.id == "BianHao" && e.keyCode == 32) {
            tag.value = "000000";
            return false;
        }
        if (e.keyCode == 13) e.keyCode = 9;
    }
    function AutoFinish(id, targetId) {

        //生成容器
        var div = document.createElement("DIV");
        div.id = id;
        div.className = "autofinish";
        div.style.display = "none";
        document.body.appendChild(div);

        var target = document.getElementById(targetId);

        var start = function() {
            if (document.activeElement != target || target.value == "") return;
            doGet();
        }

        if (target.addEventListener) {
            target.addEventListener("input", start, false);
        }
        else {
            target.onpropertychange = start;
        }

        target.onblur = function() {
            setTimeout("document.getElementById('" + id + "').style.display = 'none'", 200);
        };

        //返回数据处理函数
        var onreturn = function(http) {
            if (http.status != 200) {
                alert("服务器错误: " + http.status + " " + http.statusText);
                return;
            }
            var div = document.getElementById(id);
            var tag = document.getElementById(targetId);
            div.style.top = (getObjectTop(tag) + tag.clientHeight + 10) + "px";
            div.style.left = (getObjectLeft(tag)) + "px";
            div.style.display = "";
            div.innerHTML = "<pre style='font-size:14px;'>" + http.responseText + "</pre>";
        };

        var doGet = function() {
            var s = target.value.replace(/^\s+/, "").replace(/\s+$/, "");
            if (s == "" || s == "000000" || s.length % 2 == 1) return;
            var request = createRequest(onreturn);
            request.open("GET", encodeURI("/jidong/设备编码提示.ashx?s=" + target.value), true);
            request.send(null);
        };
    }

    AutoFinish("aaaa", "BianHao");
    //parent.hidesubmenu(true);
</script>
</body>
</html>
